#include "driver/spi_master.h"
#include "app_e_paper.h"
#include "EPD_2in13_V4.h"
#include "GUI_Paint.h"
#include "DEV_Config.h"

spi_device_handle_t spidev;

spi_device_interface_config_t devcfg = {
    .clock_speed_hz = 1 * 1000 * 1000,
    .mode = 0, // SPI mode 0
    .spics_io_num = 3,
    .queue_size = 128,
    .input_delay_ns = 10,
};

void app_e_paper_init(spi_host_device_t spi_host)
{
    spi_bus_add_device(spi_host, &devcfg, &spidev);
    DEV_GPIO_Init();

    EPD_2in13_V4_Init();
    EPD_2in13_V4_Clear();

    DEV_Delay_ms(2000);
    EPD_2in13_V4_Sleep();
    DEV_Module_Exit();
}
